package com.mbf.crm.model.dao;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.mbf.crm.model.domain.Member;

/**
 * 用户Dao<br/>
 * PagingAndSortingRepository接口继承CrudRepository接口<br/>
 * PagingAndSortingRepository接口提供了分页与排序功能<br/>
 * JpaSpecificationExecutor可以帮助我们做一些复杂的查询、多条件分页等
 * @author 晏鼠  张劲松
 *
 */
@Repository
public interface MemberDao extends PagingAndSortingRepository<Member, Long>,
		JpaSpecificationExecutor<Object> {

	int countByUserName(String userName);
	
	Member findByUserName(String userName);
	
	@Query("select m from Member m where m.id = ?1")
	Member findOne(Long id);
	
}
